home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 26.zip / BS1 part 26 / C for beginners.adf / source / screen_intuition.c < prev    next >
C/C++ Source or Header  |  1978-01-17  |  2KB  |  82 lines

  1. /* screen_intuition.c 25.3.1  */
  2. /* From Amiga C for Beginners */
  3. /* by Abacus                  */
  4.  
  5. #include <exec/types.h>
  6. #include <intuition/intuition.h>
  7.  
  8. extern LONG OpenLibrary();
  9. extern struct Screen *OpenScreen();
  10. extern struct Window *OpenWindow();
  11.  
  12. struct IntuitionBase *IntuitionBase;
  13.  
  14. #define INTUITION_REV 0
  15.  
  16. struct NewScreen NewScreen =
  17. {
  18.    0,0,
  19.    640, /* Width */
  20.    200, /* Height; PAL version-change 200 to 256 */
  21.    3,   /* 3 bitplanes = 8 colors */
  22.    3,5, /* another color combination */
  23.    HIRES,
  24.    CUSTOMSCREEN,
  25.    NULL,
  26.    "To end the program, please click Close-Gadget!",
  27.    NULL,
  28.    NULL,
  29. };
  30.  
  31. struct NewWindow NewWindow =
  32. {
  33.    40, 40,   /* X and Y Position */
  34.    280, 120,  /* Width, Height */
  35.    4, 6,     /* Colors (0 - 7) */
  36.    CLOSEWINDOW,
  37.    WINDOWCLOSE | SMART_REFRESH | ACTIVATE | WINDOWSIZING |
  38.       SIZEBRIGHT | WINDOWDRAG | WINDOWDEPTH,
  39.    NULL,
  40.    NULL,
  41.    "*** Hello ***",
  42.    NULL,
  43.    NULL,
  44.    190, 20,
  45.    640, 200, /* in PAL systems change the 200 to 256 */
  46.    CUSTOMSCREEN
  47. };
  48.  
  49.  
  50. main()
  51. {
  52.    struct Screen *Screen;
  53.    struct Window *Window;
  54.    
  55.    if((IntuitionBase = (struct IntuitionBase *)
  56.      OpenLibrary("intuition.library", INTUITION_REV))
  57.      == NULL)
  58.      exit(FALSE);
  59.  
  60.     if ( (Screen = OpenScreen(&NewScreen) ) == NULL)
  61.       exit(FALSE);
  62.  
  63.    NewWindow.Screen = Screen; /* Do not forget! */
  64.  
  65.    if( (Window = OpenWindow(&NewWindow) ) == NULL)
  66.      exit(FALSE);
  67.  
  68.    /* Wait for Close-Gadget */
  69.    Wait(1 << Window->UserPort->mp_SigBit);
  70.  
  71.    printf("\nLast window values: %d/%d/%d/%d\n\n",
  72.      Window->LeftEdge,
  73.      Window->TopEdge,
  74.      Window->Width,
  75.      Window->Height  );
  76.    CloseWindow(Window);  /* Close everything in sequence*/
  77.    CloseScreen(Screen);
  78.    CloseLibrary(IntuitionBase);
  79.    exit(TRUE);
  80. }
  81.  
  82.